package com.atguigu.gmallsugar.mapper;

import com.atguigu.gmallsugar.bean.Kw;
import com.atguigu.gmallsugar.bean.Traffic;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TrafficMapper {
    @Select("select " +
        "hour(stt) hour, " +
        "sum(pv_ct) pv, " +
        "sum(uv_ct) uv, " +
        "sum(sv_ct) sv " +
        "from dws_traffic_vc_ch_ar_is_new_page_view_window  " +
        "partition(par#{date}) " +
        "group by hour(stt);")
    List<Traffic> stat(@Param("date") Integer data);
    
    @Select("select " +
        "keyword, " +
        "sum(keyword_count) count " +
        "from dws_traffic_source_keyword_page_view_window " +
        "partition(par#{date}) " +
        "group by keyword;")
    List<Kw> kw(@Param("date") Integer data);
}
